
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>第五章：基础数据类型 ·  GO语言 web服务器区块链开发工程师就业班课程</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="波波">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-toggle-chapters/toggle.css">
                
            
                
                <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-sectionx/sectionx.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-codeblock-filename/block.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-prism/prism.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-navigator/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="../Chapter6/常量.html" />
    
    
    <link rel="prev" href="../Chapter4/变量命名规范.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    
    
        
        <li>
            <a href="http://www.shxdledu.cn/single/About-Me" target="_blank" class="custom-link">关于作者</a>
        </li>
    
    

    
    <li class="divider"></li>
    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../Chapter1/base.html">
            
                <a href="../Chapter1/base.html">
            
                    
                    第一章：区块链基础
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../Chapter2/base.html">
            
                <a href="../Chapter2/base.html">
            
                    
                    第二章：初识Go语言
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../Chapter2/GO语言介绍.html">
            
                <a href="../Chapter2/GO语言介绍.html">
            
                    
                    第1节：GO语言介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../Chapter2/环境安装.html">
            
                <a href="../Chapter2/环境安装.html">
            
                    
                    第2节：环境安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../Chapter2/第一个GO程序.html">
            
                <a href="../Chapter2/第一个GO程序.html">
            
                    
                    第3节：第一个GO程序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../Chapter2/学习资料.html">
            
                <a href="../Chapter2/学习资料.html">
            
                    
                    第4节：学习资料
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../Chapter3/注释.html">
            
                <a href="../Chapter3/注释.html">
            
                    
                    第三章：注释
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../Chapter3/注释作用.html">
            
                <a href="../Chapter3/注释作用.html">
            
                    
                    第1节：注释作用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../Chapter3/注释分类.html">
            
                <a href="../Chapter3/注释分类.html">
            
                    
                    第2节：注释分类
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="../Chapter3/学习资料.html">
            
                <a href="../Chapter3/学习资料.html">
            
                    
                    第3节：学习资料
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../Chapter4/变量.html">
            
                <a href="../Chapter4/变量.html">
            
                    
                    第四章：变量
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../Chapter4/什么叫变量.html">
            
                <a href="../Chapter4/什么叫变量.html">
            
                    
                    第1节：什么叫变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../Chapter4/变量类型.html">
            
                <a href="../Chapter4/变量类型.html">
            
                    
                    第2节：变量类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../Chapter4/变量声明.html">
            
                <a href="../Chapter4/变量声明.html">
            
                    
                    第3节：变量声明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="../Chapter4/变量初始化.html">
            
                <a href="../Chapter4/变量初始化.html">
            
                    
                    第4节：变量初始化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="../Chapter4/变量赋值.html">
            
                <a href="../Chapter4/变量赋值.html">
            
                    
                    第5节：变量赋值
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="../Chapter4/自动推导类型.html">
            
                <a href="../Chapter4/自动推导类型.html">
            
                    
                    第6节：自动推导类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="../Chapter4/多重赋值匿名变量.html">
            
                <a href="../Chapter4/多重赋值匿名变量.html">
            
                    
                    第7节：多重赋值匿名变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="../Chapter4/数据置换.html">
            
                <a href="../Chapter4/数据置换.html">
            
                    
                    第8节：数据置换
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="../Chapter4/输出格式.html">
            
                <a href="../Chapter4/输出格式.html">
            
                    
                    第9节：输出格式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.10" data-path="../Chapter4/接收输入.html">
            
                <a href="../Chapter4/接收输入.html">
            
                    
                    第10节：接收输入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.11" data-path="../Chapter4/变量命名规范.html">
            
                <a href="../Chapter4/变量命名规范.html">
            
                    
                    第11节：变量命名规范
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.12" data-path="../Chapter4/变量命名规范.html">
            
                <a href="../Chapter4/变量命名规范.html">
            
                    
                    第12节：变量命名规范
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter active" data-level="1.6" data-path="基础数据类型.html">
            
                <a href="基础数据类型.html">
            
                    
                    第五章：基础数据类型
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../Chapter6/常量.html">
            
                <a href="../Chapter6/常量.html">
            
                    
                    第六章：常量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../Chapter7/运算符.html">
            
                <a href="../Chapter7/运算符.html">
            
                    
                    第七章：运算符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../Chapter8/流程控制.html">
            
                <a href="../Chapter8/流程控制.html">
            
                    
                    第八章：流程控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../Chapter9/函数.html">
            
                <a href="../Chapter9/函数.html">
            
                    
                    第九章：函数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../Chapter10/工程管理.html">
            
                <a href="../Chapter10/工程管理.html">
            
                    
                    第十章：工程管理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../Chapter11/数据格式.html">
            
                <a href="../Chapter11/数据格式.html">
            
                    
                    第十一章：数据格式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../Chapter12/面向对象.html">
            
                <a href="../Chapter12/面向对象.html">
            
                    
                    第十二章：面向对象
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../Chapter13/异常处理.html">
            
                <a href="../Chapter13/异常处理.html">
            
                    
                    第十三章：异常处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../Chapter14/文本文件处理.html">
            
                <a href="../Chapter14/文本文件处理.html">
            
                    
                    第十四章：文本文件处理
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >第五章：基础数据类型</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x7B2C;&#x4E94;&#x7AE0;&#xFF1A;&#x57FA;&#x7840;&#x6570;&#x636E;&#x7C7B;&#x578B;">&#x7B2C;&#x4E94;&#x7AE0;&#xFF1A;&#x57FA;&#x7840;&#x6570;&#x636E;&#x7C7B;&#x578B;</h1>
<h1 id="4&#xFF1A;&#x57FA;&#x7840;&#x6570;&#x636E;&#x7C7B;&#x578B;">4&#xFF1A;&#x57FA;&#x7840;&#x6570;&#x636E;&#x7C7B;&#x578B;</h1>
<table>
<thead>
<tr>
<th style="text-align:left">&#x7C7B;&#x578B;</th>
<th style="text-align:right">&#x540D;&#x79F0;</th>
<th style="text-align:center">&#x957F;&#x5EA6;</th>
<th style="text-align:right">&#x96F6;&#x503C;</th>
<th style="text-align:center">&#x8BF4;&#x660E;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">bool</td>
<td style="text-align:right">&#x5E03;&#x5C14;&#x7C7B;&#x578B;</td>
<td style="text-align:center">1</td>
<td style="text-align:right">false</td>
<td style="text-align:center">&#x5176;&#x503C;&#x4E0D;&#x4E3A;&#x771F;&#x5373;&#x4E3A;&#x5047;&#xFF0C;&#x4E0D;&#x53EF;&#x4EE5;&#x7528;&#x6570;&#x5B57;&#x4EE3;&#x8868;true&#x6216;false</td>
</tr>
<tr>
<td style="text-align:left">byte</td>
<td style="text-align:right">&#x5B57;&#x8282;&#x578B;</td>
<td style="text-align:center">1</td>
<td style="text-align:right">0</td>
<td style="text-align:center">uint8&#x522B;&#x540D;</td>
</tr>
<tr>
<td style="text-align:left">int, uint</td>
<td style="text-align:right">&#x6574;&#x578B;</td>
<td style="text-align:center">4&#x6216;8</td>
<td style="text-align:right">0</td>
<td style="text-align:center">&#x6709;&#x7B26;&#x53F7;32&#x4F4D;&#x6216;&#x65E0;&#x7B26;&#x53F7;64&#x4F4D;</td>
</tr>
<tr>
<td style="text-align:left">int8</td>
<td style="text-align:right">&#x6574;&#x578B;</td>
<td style="text-align:center">1</td>
<td style="text-align:right">0</td>
<td style="text-align:center">-128 ~ 127,</td>
</tr>
<tr>
<td style="text-align:left">uint8</td>
<td style="text-align:right">&#x6574;&#x578B;</td>
<td style="text-align:center">1</td>
<td style="text-align:right">0</td>
<td style="text-align:center">0 ~ 255</td>
</tr>
<tr>
<td style="text-align:left">int16</td>
<td style="text-align:right">&#x6574;&#x578B;</td>
<td style="text-align:center">2</td>
<td style="text-align:right">0</td>
<td style="text-align:center">-32768 ~ 32767,</td>
</tr>
<tr>
<td style="text-align:left">uint16</td>
<td style="text-align:right">&#x6574;&#x578B;</td>
<td style="text-align:center">2</td>
<td style="text-align:right">0</td>
<td style="text-align:center">0 ~ 65535</td>
</tr>
<tr>
<td style="text-align:left">int32</td>
<td style="text-align:right">&#x6574;&#x578B;</td>
<td style="text-align:center">4</td>
<td style="text-align:right">0</td>
<td style="text-align:center">-2147483648 &#x5230; 2147483647</td>
</tr>
<tr>
<td style="text-align:left">uint32</td>
<td style="text-align:right">&#x6574;&#x578B;</td>
<td style="text-align:center">4</td>
<td style="text-align:right">0</td>
<td style="text-align:center">0 &#x5230; 4294967295(42&#x4EBF;)</td>
</tr>
<tr>
<td style="text-align:left">int64</td>
<td style="text-align:right">&#x6574;&#x578B;</td>
<td style="text-align:center">8</td>
<td style="text-align:right">0</td>
<td style="text-align:center">-9223372036854775808&#x5230; 92233720368547758070</td>
</tr>
<tr>
<td style="text-align:left">uint64</td>
<td style="text-align:right">&#x6574;&#x578B;</td>
<td style="text-align:center">8</td>
<td style="text-align:right">0</td>
<td style="text-align:center">&#x5230; 18446744073709551615(1844&#x4EAC;)</td>
</tr>
<tr>
<td style="text-align:left">float32</td>
<td style="text-align:right">&#x6D6E;&#x70B9;&#x578B;</td>
<td style="text-align:center">4</td>
<td style="text-align:right">0.0</td>
<td style="text-align:center">&#x5C0F;&#x6570;&#x4F4D;&#x7CBE;&#x786E;&#x5230;7&#x4F4D;</td>
</tr>
<tr>
<td style="text-align:left">float64</td>
<td style="text-align:right">&#x6D6E;&#x70B9;&#x578B;</td>
<td style="text-align:center">8</td>
<td style="text-align:right">0.0</td>
<td style="text-align:center">&#x5C0F;&#x6570;&#x4F4D;&#x7CBE;&#x786E;&#x5230;15&#x4F4D;</td>
</tr>
<tr>
<td style="text-align:left">string</td>
<td style="text-align:right">&#x5B57;&#x7B26;&#x4E32;</td>
<td style="text-align:center"></td>
<td style="text-align:right">&quot;&quot;</td>
<td style="text-align:center">utf-8&#x5B57;&#x7B26;&#x4E32;</td>
</tr>
</tbody>
</table>
<p>&#x4E0B;&#x9762;&#x6211;&#x4EEC;&#x770B;&#x4E00;&#x4E0B;&#x51E0;&#x4E2A;&#x975E;&#x5E38;&#x91CD;&#x8981;&#x7684;&#x7C7B;&#x578B;&#xFF0C;&#x5176;&#x5B83;&#x7C7B;&#x578B;&#x968F;&#x7740;&#x8BFE;&#x7A0B;&#x7684;&#x6DF1;&#x5165;&#xFF0C;&#x540E;&#x9762;&#x4F1A;&#x7ED9;&#x5927;&#x5BB6;&#x8BB2;&#x89E3;&#x5230;</p>
<h2 id="1&#xFF1A;&#x5E03;&#x5C14;&#x7C7B;&#x578B;">1. 1&#xFF1A;&#x5E03;&#x5C14;&#x7C7B;&#x578B;</h2>
<p>&#x5728;&#x8BA1;&#x7B97;&#x673A;&#x4E2D;,&#x6211;&#x4EEC;&#x7528;&#x4EC0;&#x4E48;&#x6570;&#x636E;&#x7C7B;&#x578B;&#x6765;&#x8868;&#x793A;&#x4E00;&#x53E5;&#x8BDD;&#x7684;&#x5BF9;&#x9519;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;&#x5728;&#x8BA1;&#x7B97;&#x673A;&#x4E2D;&#x63CF;&#x8FF0;&#x5F20;&#x4E09;(20&#x5C81;)&#x6BD4;&#x674E;&#x56DB;(18)&#x5C0F;,&#x8FD9;&#x53E5;&#x8BDD;&#x7684;&#x7ED3;&#x679C;&#xFF1F;
&#x5E03;&#x5C14;&#x7C7B;&#x578B;&#x7684;&#x53D8;&#x91CF;&#x53D6;&#x503C;&#x8981;&#x4E48;&#x662F;&#x771F;&#xFF08;true&#xFF09;,&#x8981;&#x4E48;&#x662F;&#x5047;(false),&#x7528;bool&#x5173;&#x952E;&#x5B57;&#x6765;&#x8FDB;&#x884C;&#x5B9A;&#x4E49;&#x3002;&#x793A;&#x4F8B;&#x5982;&#x4E0B;&#xFF1A;</p>
<pre class="language-"><code>
package main
// 09
import &quot;fmt&quot;

func main() {
    //&#x5E03;&#x5C14;&#x7C7B;&#x578B;  &#x503C;&#x4E3A;true &#x6216;&#x8005;&#x4E3A; false
    //var a bool //&#x9ED8;&#x8BA4;&#x503C;&#x4E3A;false
    ////bool&#x7C7B;&#x578B;&#x4E00;&#x822C;&#x7528;&#x4E8E;&#x6761;&#x4EF6;&#x5224;&#x65AD;
    //a = true
    //fmt.Println(a)

    //&#x81EA;&#x52A8;&#x63A8;&#x5230;&#x7C7B;&#x578B;&#x521B;&#x5EFA;bool&#x7C7B;&#x578B;&#x53D8;&#x91CF;
    a := false //bool

    //a=true
    //fmt.Println(a)
    //%T&#x662F;&#x4E00;&#x4E2A;&#x5360;&#x4F4D;&#x7B26; &#x8868;&#x793A;&#x8F93;&#x51FA;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x5BF9;&#x5E94;&#x7684;&#x6570;&#x636E;&#x7C7B;&#x578B;
    fmt.Printf(&quot;%T\n&quot;, a)
    b := 10 //int
    fmt.Printf(&quot;%T\n&quot;, b)
    c := 3.14 //float64
    fmt.Printf(&quot;%T\n&quot;, c)
    d := &quot;&#x4F60;&#x4E2A;&#x9524;&#x5B50;&quot;//string
    fmt.Printf(&quot;%T&quot;, d)
}
</code></pre><p>&#x5E03;&#x5C14;&#x7C7B;&#x578B;&#x4E3B;&#x8981;&#x7528;&#x4E8E;&#x540E;&#x9762;&#x8BB2;&#x89E3;&#x7684;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#xFF0C;&#x5173;&#x4E8E;&#x6761;&#x4EF6;&#x5224;&#x65AD;&#xFF0C;&#x6211;&#x4EEC;&#x5728;&#x8FD9;&#x91CC;&#x5148;&#x4E3E;&#x4E00;&#x4E2A;&#x751F;&#x6D3B;&#x4E2D;&#x7684;&#x6848;&#x4F8B;&#xFF0C;&#x5927;&#x5BB6;&#x53EF;&#x4EE5;&#x7406;&#x89E3;&#x4E00;&#x4E0B;&#xFF1A;</p>
<p><img src="https://leanote.com/api/file/getImage?fileId=5da35cfeab644167210004b5" alt="title"></p>
<h2 id="2&#xFF1A;&#x6D6E;&#x70B9;&#x578B;">2. 2&#xFF1A;&#x6D6E;&#x70B9;&#x578B;</h2>
<pre class="language-"><code>package main

import &quot;fmt&quot;

func main0101() {

    //&#x6D6E;&#x70B9;&#x578B;&#x6570;&#x636E; &#x5206;&#x4E3A; &#x5355;&#x7CBE;&#x5EA6;&#x6D6E;&#x70B9;&#x578B; float32&#xFF08;&#x5C0F;&#x6570;&#x4F4D;&#x6570;&#x4E3A;7&#x4F4D;&#xFF09; &#x53CC;&#x7CBE;&#x5EA6;&#x6D6E;&#x70B9;&#x578B; float64&#xFF08;&#x5C0F;&#x6570;&#x4F4D;&#x6570;&#x4E3A;15&#x4F4D;&#xFF09;
    //float64 &#x6BD4; float32 &#x66F4;&#x7CBE;&#x51C6;
    //var a float64=1223.456
    ////&#x4FDD;&#x7559;&#x516D;&#x4F4D;&#x5C0F;&#x6570;&#x6570;&#x636E;&#x4F1A;&#x66F4;&#x7CBE;&#x51C6;
    //fmt.Printf(&quot;%f\n&quot;,a)
    //var a float32 =3.14
    //
    //fmt.Printf(&quot;%.2f&quot;,a)

    //&#x901A;&#x8FC7;&#x81EA;&#x52A8;&#x63A8;&#x5230;&#x7C7B;&#x578B;&#x521B;&#x5EFA;&#x7684;&#x6D6E;&#x70B9;&#x578B;&#x53D8;&#x91CF; &#x9ED8;&#x8BA4;&#x7C7B;&#x578B;&#x4E3A;float64
    a := 123.456
    fmt.Printf(&quot;%T\n&quot;, a)
}

//&#x4E70;&#x9EC4;&#x74DC; 3.2&#x4E00;&#x65A4; &#x4E70;3&#x65A4;

func main() {
    price := 3.2
    var weight float64

    fmt.Scan(&amp;weight)

    sum := price * weight

    //fmt.Println(sum)
    fmt.Printf(&quot;%.2f&quot;,sum)
}
</code></pre><h2 id="3&#xFF1A;&#x5B57;&#x7B26;&#x7C7B;&#x578B;">3. 3&#xFF1A;&#x5B57;&#x7B26;&#x7C7B;&#x578B;</h2>
<pre class="language-"><code>package main

import &quot;fmt&quot;

func main0201() {
    //byte&#x5B57;&#x7B26;&#x7C7B;&#x578B; &#x540C;&#x65F6;&#x4E5F;&#x662F;uint8&#x7684;&#x522B;&#x540D;
    var a byte = &apos;a&apos;

    //&#x6240;&#x6709;&#x7684;&#x5B57;&#x7B26;&#x90FD;&#x5BF9;&#x5E94;ASCII&#x4E2D;&#x7684;&#x6574;&#x578B;&#x6570;&#x636E;
    //&apos;0&apos;&#x5BF9;&#x5E94;&#x7684;48  &apos;A&apos;&#x5BF9;&#x5E94;&#x7684;65 &apos;a&apos; &#x5BF9;&#x5E94;&#x7684;97
    //fmt.Println(a)

    //%c&#x662F;&#x4E00;&#x4E2A;&#x5360;&#x4F4D;&#x7B26; &#x8868;&#x793A;&#x6253;&#x5370;&#x8F93;&#x51FA;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;
    fmt.Printf(&quot;%c\n&quot;, a)
    fmt.Printf(&quot;%c\n&quot;, 97)

    fmt.Printf(&quot;%T\n&quot;, a)
    var b byte = &apos;0&apos; //&#x5B57;&#x7B26;0  &#x5BF9;&#x5E94;&#x7684;ASCII&#x503C;&#x4E3A;&#x4E3A;48

    fmt.Printf(&quot;%c\n&quot;, 48)
    fmt.Printf(&quot;%c\n&quot;, b)
}
func main0202() {

    var a byte = &apos;a&apos;
    //&#x5C06;&#x5C0F;&#x5199;&#x5B57;&#x6BCD;&#x8F6C;&#x6210;&#x5927;&#x5199;&#x5B57;&#x6BCD;&#x8F93;&#x51FA;
    fmt.Printf(&quot;%c&quot;, a-32)
}

func main() {
    //&#x8F6C;&#x4E49;&#x5B57;&#x7B26; \n &#x6362;&#x884C;

    //var a byte = &apos;\n&apos;
    //\0  &#x5BF9;&#x5E94;&#x7684;ASCII &#x503C;&#x4E3A;0 &#x7528;&#x4E8E;&#x5B57;&#x7B26;&#x4E32;&#x7684;&#x7ED3;&#x675F;&#x6807;&#x5FD7;
    //\t &#x5BF9;&#x5E94;&#x7684;ASCII &#x503C;&#x4E3A;9 &#x6C34;&#x5E73;&#x5236;&#x8868;&#x7B26; &#x4E00;&#x6B21;&#x8DF3;&#x516B;&#x4E2A;&#x7A7A;&#x683C;
    var a byte =&apos;\t&apos;
    //fmt.Println(a)
    fmt.Printf(&quot;%c&quot;,a)


}
</code></pre><h2 id="4&#xFF1A;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;">4. 4&#xFF1A;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;</h2>
<pre class="language-"><code>package main

import &quot;fmt&quot;

func main0301() {
    //var a string = &quot;&#x4F60;&#x597D;&quot;
    ////fmt.Println(a)
    //fmt.Printf(&quot;%s&quot;,a)
    //a:=&quot;&#x4F60;&#x597D;&quot;
    //fmt.Println(a)
    //fmt.Printf(&quot;%s&quot;,a)
    //&#x53CC;&#x5F15;&#x53F7;&#x5F15;&#x8D77;&#x6765;&#x7684;&#x79F0;&#x4E3A;&#x5B57;&#x7B26;&#x4E32;
    ch := &apos;a&apos;
    str := &quot;a&quot; //&apos;a&apos;&apos;\0&apos;&#x5B57;&#x7B26;&#x4E32;&#x7ED3;&#x675F;&#x6807;&#x5FD7;

    fmt.Printf(&quot;%c\n&quot;, ch)
    //%s&#x6253;&#x5370;&#x5B57;&#x7B26;&#x4E32;&#x6253;&#x5370;&#x5230;\0&#x4E4B;&#x524D;&#x7684;&#x5185;&#x5BB9;
    fmt.Printf(&quot;%s\n&quot;, str)

}

func main0302() {
    // &#x5B57;&#x7B26;&#x4E0E;&#x5B57;&#x7B26;&#x4E32;&#x533A;&#x522B;
    //len &#x51FD;&#x6570;  &#x7528;&#x6765;&#x8BA1;&#x7B97;&#x5B57;&#x7B26;&#x4E32;&#x4E2D;&#x5B57;&#x7B26;&#x4E2A;&#x6570; &#x4E0D;&#x5305;&#x542B;\0  &#x8FD4;&#x56DE;&#x503C;&#x4E3A;int&#x7C7B;&#x578B;
    //a := &quot;hello&quot;
    //&#x5728;go&#x8BED;&#x8A00;&#x4E2D;&#x4E00;&#x4E2A;&#x6C49;&#x5B57;&#x5360;3&#x4E2A;&#x5B57;&#x7B26;  &#x4E3A;&#x4E86;&#x548C;linux&#x8FDB;&#x884C;&#x7EDF;&#x4E00;&#x5904;&#x7406;
    a := &quot;bokedu&quot;
    var count int
    count = len(a)
    fmt.Println(count)

}
func main() {
    str1 := &quot;&#x6FB3;&#x95E8;&#x5728;&#x7EBF;&#x8D4C;&#x573A;&#x4E0A;&#x7EBF;&#x4E86;&quot;
    str2 := &quot;&#x6027;&#x611F;&#x8377;&#x5B98;&#x5728;&#x7EBF;&#x53D1;&#x724C;&quot;

    //&#x5B57;&#x7B26;&#x4E32;&#x8FDE;&#x63A5;  +
    str3 := str1 + str2

    fmt.Println(str3)

}
</code></pre><h2 id="5&#xFF1A;&#x5B57;&#x7B26;&#x4E0E;&#x5B57;&#x7B26;&#x4E32;&#x533A;&#x522B;">5. 5&#xFF1A;&#x5B57;&#x7B26;&#x4E0E;&#x5B57;&#x7B26;&#x4E32;&#x533A;&#x522B;</h2>
<p>&#x4E0A;&#x9762;&#x7684;&#x4EE3;&#x7801;&#x4E2D;&#x5DF2;&#x7ECF;&#x5B9E;&#x73B0;</p>
<h2 id="6&#xFF1A;fmt&#x5305;&#x7684;&#x683C;&#x5F0F;&#x5316;&#x8F93;&#x51FA;&#x8F93;&#x5165;">6. 6&#xFF1A;fmt&#x5305;&#x7684;&#x683C;&#x5F0F;&#x5316;&#x8F93;&#x51FA;&#x8F93;&#x5165;</h2>
<p>&#x6211;&#x4EEC;&#x524D;&#x9762;&#x5728;&#x8F93;&#x51FA;&#x4E0E;&#x8F93;&#x5165;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;&#xFF0C;&#x5B57;&#x7B26;&#x7C7B;&#x578B;&#xFF0C;&#x6574;&#x578B;&#x7B49;&#x90FD;&#x6307;&#x5B9A;&#x4E86;&#x5BF9;&#x5E94;&#x7684;&#x683C;&#x5F0F;&#x5316;&#xFF0C;&#x90A3;&#x4E48;go&#x8BED;&#x8A00;&#x4E2D;&#x8FD8;&#x6709;&#x54EA;&#x4E9B;&#x683C;&#x5F0F;&#x5316;&#x5462;&#xFF1F;</p>
<table>
<thead>
<tr>
<th style="text-align:left">&#x683C;&#x5F0F;</th>
<th style="text-align:center">&#x542B;&#x4E49;</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">%%</td>
<td style="text-align:center">&#x4E00;&#x4E2A;%&#x5B57;&#x9762;&#x91CF;</td>
</tr>
<tr>
<td style="text-align:left">%b</td>
<td style="text-align:center">&#x4E00;&#x4E2A;&#x4E8C;&#x8FDB;&#x5236;&#x6574;&#x6570;&#x503C;(&#x57FA;&#x6570;&#x4E3A;2)&#xFF0C;&#x6216;&#x8005;&#x662F;&#x4E00;&#x4E2A;(&#x9AD8;&#x7EA7;&#x7684;)&#x7528;&#x79D1;&#x5B66;&#x8BA1;&#x6570;&#x6CD5;&#x8868;&#x793A;&#x7684;&#x6307;&#x6570;&#x4E3A;2&#x7684;&#x6D6E;&#x70B9;&#x6570;</td>
</tr>
<tr>
<td style="text-align:left">%c</td>
<td style="text-align:center">&#x5B57;&#x7B26;&#x578B;&#x3002;&#x53EF;&#x4EE5;&#x628A;&#x8F93;&#x5165;&#x7684;&#x6570;&#x5B57;&#x6309;&#x7167;ASCII&#x7801;&#x76F8;&#x5E94;&#x8F6C;&#x6362;&#x4E3A;&#x5BF9;&#x5E94;&#x7684;&#x5B57;&#x7B26;</td>
</tr>
<tr>
<td style="text-align:left">%d</td>
<td style="text-align:center">&#x4E00;&#x4E2A;&#x5341;&#x8FDB;&#x5236;&#x6570;&#x503C;(&#x57FA;&#x6570;&#x4E3A;10)</td>
</tr>
<tr>
<td style="text-align:left">%e</td>
<td style="text-align:center">&#x4EE5;&#x79D1;&#x5B66;&#x8BB0;&#x6570;&#x6CD5;e&#x8868;&#x793A;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x8005;&#x590D;&#x6570;&#x503C;</td>
</tr>
<tr>
<td style="text-align:left">%E</td>
<td style="text-align:center">&#x4EE5;&#x79D1;&#x5B66;&#x8BB0;&#x6570;&#x6CD5;E&#x8868;&#x793A;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x8005;&#x590D;&#x6570;&#x503C;</td>
</tr>
<tr>
<td style="text-align:left">%f</td>
<td style="text-align:center">&#x4EE5;&#x6807;&#x51C6;&#x8BB0;&#x6570;&#x6CD5;&#x8868;&#x793A;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x8005;&#x590D;&#x6570;&#x503C;</td>
</tr>
<tr>
<td style="text-align:left">%g</td>
<td style="text-align:center">&#x4EE5;%e&#x6216;&#x8005;%f&#x8868;&#x793A;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x8005;&#x590D;&#x6570;&#xFF0C;&#x4EFB;&#x4F55;&#x4E00;&#x4E2A;&#x90FD;&#x4EE5;&#x6700;&#x4E3A;&#x7D27;&#x51D1;&#x7684;&#x65B9;&#x5F0F;&#x8F93;&#x51FA;</td>
</tr>
<tr>
<td style="text-align:left">%G</td>
<td style="text-align:center">&#x4EE5;%E&#x6216;&#x8005;%f&#x8868;&#x793A;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x8005;&#x590D;&#x6570;&#xFF0C;&#x4EFB;&#x4F55;&#x4E00;&#x4E2A;&#x90FD;&#x4EE5;&#x6700;&#x4E3A;&#x7D27;&#x51D1;&#x7684;&#x65B9;&#x5F0F;&#x8F93;&#x51FA;</td>
</tr>
<tr>
<td style="text-align:left">%o</td>
<td style="text-align:center">&#x4E00;&#x4E2A;&#x4EE5;&#x516B;&#x8FDB;&#x5236;&#x8868;&#x793A;&#x7684;&#x6570;&#x5B57;(&#x57FA;&#x6570;&#x4E3A;8)</td>
</tr>
<tr>
<td style="text-align:left">%p</td>
<td style="text-align:center">&#x4EE5;&#x5341;&#x516D;&#x8FDB;&#x5236;(&#x57FA;&#x6570;&#x4E3A;16)&#x8868;&#x793A;&#x7684;&#x4E00;&#x4E2A;&#x503C;&#x7684;&#x5730;&#x5740;&#xFF0C;&#x524D;&#x7F00;&#x4E3A;0x,&#x5B57;&#x6BCD;&#x4F7F;&#x7528;&#x5C0F;&#x5199;&#x7684;a-f&#x8868;&#x793A;</td>
</tr>
<tr>
<td style="text-align:left">%q</td>
<td style="text-align:center">&#x4F7F;&#x7528;Go&#x8BED;&#x6CD5;&#x4EE5;&#x53CA;&#x5FC5;&#x987B;&#x65F6;&#x4F7F;&#x7528;&#x8F6C;&#x4E49;&#xFF0C;&#x4EE5;&#x53CC;&#x5F15;&#x53F7;&#x62EC;&#x8D77;&#x6765;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x6216;&#x8005;&#x5B57;&#x8282;&#x5207;&#x7247;[]byte&#xFF0C;&#x6216;&#x8005;&#x662F;&#x4EE5;&#x5355;&#x5F15;&#x53F7;&#x62EC;&#x8D77;&#x6765;&#x7684;&#x6570;&#x5B57;</td>
</tr>
<tr>
<td style="text-align:left">%s</td>
<td style="text-align:center">&#x5B57;&#x7B26;&#x4E32;&#x3002;&#x8F93;&#x51FA;&#x5B57;&#x7B26;&#x4E32;&#x4E2D;&#x7684;&#x5B57;&#x7B26;&#x76F4;&#x81F3;&#x5B57;&#x7B26;&#x4E32;&#x4E2D;&#x7684;&#x7A7A;&#x5B57;&#x7B26;&#xFF08;&#x5B57;&#x7B26;&#x4E32;&#x4EE5;&apos;\0&#x2018;&#x7ED3;&#x5C3E;&#xFF0C;&#x8FD9;&#x4E2A;&apos;\0&apos;&#x5373;&#x7A7A;&#x5B57;&#x7B26;&#xFF09;</td>
</tr>
<tr>
<td style="text-align:left">%t</td>
<td style="text-align:center">&#x4EE5;true&#x6216;&#x8005;false&#x8F93;&#x51FA;&#x7684;&#x5E03;&#x5C14;&#x503C;</td>
</tr>
<tr>
<td style="text-align:left">%T</td>
<td style="text-align:center">&#x4F7F;&#x7528;Go&#x8BED;&#x6CD5;&#x8F93;&#x51FA;&#x7684;&#x503C;&#x7684;&#x7C7B;&#x578B;</td>
</tr>
<tr>
<td style="text-align:left">%U</td>
<td style="text-align:center">&#x4E00;&#x4E2A;&#x7528;Unicode&#x8868;&#x793A;&#x6CD5;&#x8868;&#x793A;&#x7684;&#x6574;&#x578B;&#x7801;&#x70B9;&#xFF0C;&#x9ED8;&#x8BA4;&#x503C;&#x4E3A;4&#x4E2A;&#x6570;&#x5B57;&#x5B57;&#x7B26;</td>
</tr>
<tr>
<td style="text-align:left">%v</td>
<td style="text-align:center">&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x683C;&#x5F0F;&#x8F93;&#x51FA;&#x7684;&#x5185;&#x7F6E;&#x6216;&#x8005;&#x81EA;&#x5B9A;&#x4E49;&#x7C7B;&#x578B;&#x7684;&#x503C;&#xFF0C;&#x6216;&#x8005;&#x662F;&#x4F7F;&#x7528;&#x5176;&#x7C7B;&#x578B;&#x7684;String()&#x65B9;&#x5F0F;&#x8F93;&#x51FA;&#x7684;&#x81EA;&#x5B9A;&#x4E49;&#x503C;&#xFF0C;&#x5982;&#x679C;&#x8BE5;&#x65B9;&#x6CD5;&#x5B58;&#x5728;&#x7684;&#x8BDD;</td>
</tr>
<tr>
<td style="text-align:left">%x</td>
<td style="text-align:center">&#x4EE5;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x8868;&#x793A;&#x7684;&#x6574;&#x578B;&#x503C;(&#x57FA;&#x6570;&#x4E3A;&#x5341;&#x516D;)&#xFF0C;&#x6570;&#x5B57;a-f&#x4F7F;&#x7528;&#x5C0F;&#x5199;&#x8868;&#x793A;</td>
</tr>
<tr>
<td style="text-align:left">%X</td>
<td style="text-align:center">&#x4EE5;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x8868;&#x793A;&#x7684;&#x6574;&#x578B;&#x503C;(&#x57FA;&#x6570;&#x4E3A;&#x5341;&#x516D;)&#xFF0C;&#x6570;&#x5B57;A-F&#x4F7F;&#x7528;&#x5C0F;&#x5199;&#x8868;&#x793A;</td>
</tr>
<tr>
<td style="text-align:left">%%</td>
<td style="text-align:center">&#x4E00;&#x4E2A;%&#x5B57;&#x9762;&#x91CF;</td>
</tr>
<tr>
<td style="text-align:left">%b</td>
<td style="text-align:center">&#x4E00;&#x4E2A;&#x4E8C;&#x8FDB;&#x5236;&#x6574;&#x6570;&#x503C;(&#x57FA;&#x6570;&#x4E3A;2)&#xFF0C;&#x6216;&#x8005;&#x662F;&#x4E00;&#x4E2A;(&#x9AD8;&#x7EA7;&#x7684;)&#x7528;&#x79D1;&#x5B66;&#x8BA1;&#x6570;&#x6CD5;&#x8868;&#x793A;&#x7684;&#x6307;&#x6570;&#x4E3A;2&#x7684;&#x6D6E;&#x70B9;&#x6570;</td>
</tr>
<tr>
<td style="text-align:left">%c</td>
<td style="text-align:center">&#x5B57;&#x7B26;&#x578B;&#x3002;&#x53EF;&#x4EE5;&#x628A;&#x8F93;&#x5165;&#x7684;&#x6570;&#x5B57;&#x6309;&#x7167;ASCII&#x7801;&#x76F8;&#x5E94;&#x8F6C;&#x6362;&#x4E3A;&#x5BF9;&#x5E94;&#x7684;&#x5B57;&#x7B26;</td>
</tr>
<tr>
<td style="text-align:left">%d</td>
<td style="text-align:center">&#x4E00;&#x4E2A;&#x5341;&#x8FDB;&#x5236;&#x6570;&#x503C;(&#x57FA;&#x6570;&#x4E3A;10)</td>
</tr>
<tr>
<td style="text-align:left">%e</td>
<td style="text-align:center">&#x4EE5;&#x79D1;&#x5B66;&#x8BB0;&#x6570;&#x6CD5;e&#x8868;&#x793A;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x8005;&#x590D;&#x6570;&#x503C;</td>
</tr>
<tr>
<td style="text-align:left">%E</td>
<td style="text-align:center">&#x4EE5;&#x79D1;&#x5B66;&#x8BB0;&#x6570;&#x6CD5;E&#x8868;&#x793A;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x8005;&#x590D;&#x6570;&#x503C;</td>
</tr>
<tr>
<td style="text-align:left">%f</td>
<td style="text-align:center">&#x4EE5;&#x6807;&#x51C6;&#x8BB0;&#x6570;&#x6CD5;&#x8868;&#x793A;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x8005;&#x590D;&#x6570;&#x503C;</td>
</tr>
<tr>
<td style="text-align:left">%g</td>
<td style="text-align:center">&#x4EE5;%e&#x6216;&#x8005;%f&#x8868;&#x793A;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x8005;&#x590D;&#x6570;&#xFF0C;&#x4EFB;&#x4F55;&#x4E00;&#x4E2A;&#x90FD;&#x4EE5;&#x6700;&#x4E3A;&#x7D27;&#x51D1;&#x7684;&#x65B9;&#x5F0F;&#x8F93;&#x51FA;</td>
</tr>
<tr>
<td style="text-align:left">%G</td>
<td style="text-align:center">&#x4EE5;%E&#x6216;&#x8005;%f&#x8868;&#x793A;&#x7684;&#x6D6E;&#x70B9;&#x6570;&#x6216;&#x8005;&#x590D;&#x6570;&#xFF0C;&#x4EFB;&#x4F55;&#x4E00;&#x4E2A;&#x90FD;&#x4EE5;&#x6700;&#x4E3A;&#x7D27;&#x51D1;&#x7684;&#x65B9;&#x5F0F;&#x8F93;&#x51FA;</td>
</tr>
<tr>
<td style="text-align:left">%o</td>
<td style="text-align:center">&#x4E00;&#x4E2A;&#x4EE5;&#x516B;&#x8FDB;&#x5236;&#x8868;&#x793A;&#x7684;&#x6570;&#x5B57;(&#x57FA;&#x6570;&#x4E3A;8)</td>
</tr>
<tr>
<td style="text-align:left">%p</td>
<td style="text-align:center">&#x4EE5;&#x5341;&#x516D;&#x8FDB;&#x5236;(&#x57FA;&#x6570;&#x4E3A;16)&#x8868;&#x793A;&#x7684;&#x4E00;&#x4E2A;&#x503C;&#x7684;&#x5730;&#x5740;&#xFF0C;&#x524D;&#x7F00;&#x4E3A;0x,&#x5B57;&#x6BCD;&#x4F7F;&#x7528;&#x5C0F;&#x5199;&#x7684;a-f&#x8868;&#x793A;</td>
</tr>
<tr>
<td style="text-align:left">%q</td>
<td style="text-align:center">&#x4F7F;&#x7528;Go&#x8BED;&#x6CD5;&#x4EE5;&#x53CA;&#x5FC5;&#x987B;&#x65F6;&#x4F7F;&#x7528;&#x8F6C;&#x4E49;&#xFF0C;&#x4EE5;&#x53CC;&#x5F15;&#x53F7;&#x62EC;&#x8D77;&#x6765;&#x7684;&#x5B57;&#x7B26;&#x4E32;&#x6216;&#x8005;&#x5B57;&#x8282;&#x5207;&#x7247;[]byte&#xFF0C;&#x6216;&#x8005;&#x662F;&#x4EE5;&#x5355;&#x5F15;&#x53F7;&#x62EC;&#x8D77;&#x6765;&#x7684;&#x6570;&#x5B57;</td>
</tr>
<tr>
<td style="text-align:left">%s</td>
<td style="text-align:center">&#x5B57;&#x7B26;&#x4E32;&#x3002;&#x8F93;&#x51FA;&#x5B57;&#x7B26;&#x4E32;&#x4E2D;&#x7684;&#x5B57;&#x7B26;&#x76F4;&#x81F3;&#x5B57;&#x7B26;&#x4E32;&#x4E2D;&#x7684;&#x7A7A;&#x5B57;&#x7B26;&#xFF08;&#x5B57;&#x7B26;&#x4E32;&#x4EE5;&apos;\0&#x2018;&#x7ED3;&#x5C3E;&#xFF0C;&#x8FD9;&#x4E2A;&apos;\0&apos;&#x5373;&#x7A7A;&#x5B57;&#x7B26;&#xFF09;</td>
</tr>
<tr>
<td style="text-align:left">%t</td>
<td style="text-align:center">&#x4EE5;true&#x6216;&#x8005;false&#x8F93;&#x51FA;&#x7684;&#x5E03;&#x5C14;&#x503C;</td>
</tr>
<tr>
<td style="text-align:left">%T</td>
<td style="text-align:center">&#x4F7F;&#x7528;Go&#x8BED;&#x6CD5;&#x8F93;&#x51FA;&#x7684;&#x503C;&#x7684;&#x7C7B;&#x578B;</td>
</tr>
<tr>
<td style="text-align:left">%U</td>
<td style="text-align:center">&#x4E00;&#x4E2A;&#x7528;Unicode&#x8868;&#x793A;&#x6CD5;&#x8868;&#x793A;&#x7684;&#x6574;&#x578B;&#x7801;&#x70B9;&#xFF0C;&#x9ED8;&#x8BA4;&#x503C;&#x4E3A;4&#x4E2A;&#x6570;&#x5B57;&#x5B57;&#x7B26;</td>
</tr>
<tr>
<td style="text-align:left">%v</td>
<td style="text-align:center">&#x4F7F;&#x7528;&#x9ED8;&#x8BA4;&#x683C;&#x5F0F;&#x8F93;&#x51FA;&#x7684;&#x5185;&#x7F6E;&#x6216;&#x8005;&#x81EA;&#x5B9A;&#x4E49;&#x7C7B;&#x578B;&#x7684;&#x503C;&#xFF0C;&#x6216;&#x8005;&#x662F;&#x4F7F;&#x7528;&#x5176;&#x7C7B;&#x578B;&#x7684;String()&#x65B9;&#x5F0F;&#x8F93;&#x51FA;&#x7684;&#x81EA;&#x5B9A;&#x4E49;&#x503C;&#xFF0C;&#x5982;&#x679C;&#x8BE5;&#x65B9;&#x6CD5;&#x5B58;&#x5728;&#x7684;&#x8BDD;</td>
</tr>
<tr>
<td style="text-align:left">%x</td>
<td style="text-align:center">&#x4EE5;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x8868;&#x793A;&#x7684;&#x6574;&#x578B;&#x503C;(&#x57FA;&#x6570;&#x4E3A;&#x5341;&#x516D;)&#xFF0C;&#x6570;&#x5B57;a-f&#x4F7F;&#x7528;&#x5C0F;&#x5199;&#x8868;&#x793A;</td>
</tr>
<tr>
<td style="text-align:left">%X</td>
<td style="text-align:center">&#x4EE5;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x8868;&#x793A;&#x7684;&#x6574;&#x578B;&#x503C;(&#x57FA;&#x6570;&#x4E3A;&#x5341;&#x516D;)&#xFF0C;&#x6570;&#x5B57;A-F&#x4F7F;&#x7528;&#x5C0F;&#x5199;&#x8868;&#x793A;</td>
</tr>
</tbody>
</table>
<pre class="language-"><code>package main

import &quot;fmt&quot;

func main0401() {

    //fmt.Printf(&quot;35%%&quot;)

    //&#x5341;&#x8FDB;&#x5236;&#x6574;&#x578B;&#x6570;&#x636E;
    a := 123

    //%b &#x5360;&#x4F4D;&#x7B26; &#x6253;&#x5370;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x683C;&#x5F0F;
    fmt.Printf(&quot;%b\n&quot;, a)
    //%o &#x5360;&#x4F4D;&#x7B26; &#x6253;&#x5370;&#x4E00;&#x4E2A;&#x6570;&#x636E;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x683C;&#x5F0F;
    fmt.Printf(&quot;%o\n&quot;, a)
    //%x %X &#x5360;&#x4F4D;&#x7B26; &#x5341;&#x516D;&#x8FDB;&#x5236;
    //10-15&#x7528;a-f&#x8868;&#x793A; %x  a-f  %X A-F
    fmt.Printf(&quot;%x\n&quot;, a)
    fmt.Printf(&quot;%X\n&quot;, a)
    //&#x5341;&#x8FDB;&#x5236;
    fmt.Println(a)
    fmt.Printf(&quot;%d\n&quot;, a)

}

func main0402() {
    //&#x5341;&#x8FDB;&#x5236;&#x6570;&#x636E;
    var a int = 10
    //&#x516B;&#x8FDB;&#x5236;&#x6570;&#x636E;  &#x516B;&#x8FDB;&#x5236;&#x6570;&#x636E;&#x662F;&#x4EE5;0&#x5F00;&#x5934;  &#x6700;&#x5927;&#x503C;&#x4E3A;7
    var b int = 010
    //&#x5341;&#x516D;&#x8FDB;&#x5236;&#x6570;&#x636E;  &#x5341;&#x516D;&#x8FDB;&#x5236;&#x6570;&#x636E;&#x662F;&#x4EE5;0x&#x5F00;&#x5934;
    //10-15&#x7528;a-f&#x8868;&#x793A; %x  a-f  %X A-F
    var c int = 0xABC

    //&#x4E8C;&#x8FDB;&#x5236;  &#x4E0D;&#x80FD;&#x5728;go&#x8BED;&#x8A00;&#x4E2D;&#x76F4;&#x63A5;&#x8868;&#x793A;

    fmt.Println(a)
    fmt.Println(b)
    fmt.Println(c)

}

func main() {
    //&apos;&apos;&#x5F15;&#x8D77;&#x6765;&#x7684;&#x667A;&#x80FD;&#x5B58;&#x50A8;&#x4E00;&#x4E2A;&#x5B57;&#x7B26;
    ch := &apos;a&apos; //&apos;\n&apos;
    str := &quot;&#x74DC;&#x5A03;&#x5B50;&quot;
    fmt.Printf(&quot;%c\n&quot;, ch)
    fmt.Printf(&quot;%s\n&quot;, str)
    fmt.Println(ch)

    //%p &#x5360;&#x4F4D;&#x7B26; &#x6253;&#x5370;&#x662F;&#x4E00;&#x4E2A;&#x53D8;&#x91CF;&#x5BF9;&#x5E94;&#x7684;&#x5185;&#x5B58;&#x5730;&#x5740; &#x662F;&#x4EE5;&#x65E0;&#x7B26;&#x53F7;&#x5341;&#x516D;&#x8FDB;&#x5236;&#x6574;&#x578B;&#x8868;&#x793A;
    fmt.Printf(&quot;%p\n&quot;, &amp;ch)
    fmt.Printf(&quot;%p\n&quot;, &amp;str)

    a := false

    //%t&#x5360;&#x4F4D;&#x7B26; &#x6253;&#x5370;bool&#x7C7B;&#x578B;&#x7684;&#x503C;
    fmt.Printf(&quot;%t\n&quot;,a)
    fmt.Println(a)
}
</code></pre><footer class="page-footer"><span class="copyright">Copyright &#xA9; shxdledu.cn 2018 all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x4FEE;&#x8BA2;&#x65F6;&#x95F4;&#xFF1A;
2019-11-06 00:42:00
</span></footer><div id="anchors-navbar"><i class="fa fa-anchor"></i><ul><p><a href="#4&#xFF1A;&#x57FA;&#x7840;&#x6570;&#x636E;&#x7C7B;&#x578B;">4&#xFF1A;&#x57FA;&#x7840;&#x6570;&#x636E;&#x7C7B;&#x578B;</a></p><li><a href="#1&#xFF1A;&#x5E03;&#x5C14;&#x7C7B;&#x578B;">1. 1&#xFF1A;&#x5E03;&#x5C14;&#x7C7B;&#x578B;</a></li><li><a href="#2&#xFF1A;&#x6D6E;&#x70B9;&#x578B;">2. 2&#xFF1A;&#x6D6E;&#x70B9;&#x578B;</a></li><li><a href="#3&#xFF1A;&#x5B57;&#x7B26;&#x7C7B;&#x578B;">3. 3&#xFF1A;&#x5B57;&#x7B26;&#x7C7B;&#x578B;</a></li><li><a href="#4&#xFF1A;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;">4. 4&#xFF1A;&#x5B57;&#x7B26;&#x4E32;&#x7C7B;&#x578B;</a></li><li><a href="#5&#xFF1A;&#x5B57;&#x7B26;&#x4E0E;&#x5B57;&#x7B26;&#x4E32;&#x533A;&#x522B;">5. 5&#xFF1A;&#x5B57;&#x7B26;&#x4E0E;&#x5B57;&#x7B26;&#x4E32;&#x533A;&#x522B;</a></li><li><a href="#6&#xFF1A;fmt&#x5305;&#x7684;&#x683C;&#x5F0F;&#x5316;&#x8F93;&#x51FA;&#x8F93;&#x5165;">6. 6&#xFF1A;fmt&#x5305;&#x7684;&#x683C;&#x5F0F;&#x5316;&#x8F93;&#x51FA;&#x8F93;&#x5165;</a></li></ul></div><a href="#1&#xFF1A;&#x5E03;&#x5C14;&#x7C7B;&#x578B;" id="goTop"><i class="fa fa-arrow-up"></i></a>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../Chapter4/变量命名规范.html" class="navigation navigation-prev " aria-label="Previous page: 第12节：变量命名规范">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="../Chapter6/常量.html" class="navigation navigation-next " aria-label="Next page: 第六章：常量">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"第五章：基础数据类型","level":"1.6","depth":1,"next":{"title":"第六章：常量","level":"1.7","depth":1,"path":"Chapter6/常量.md","ref":"Chapter6/常量.md","articles":[]},"previous":{"title":"第12节：变量命名规范","level":"1.5.12","depth":2,"path":"Chapter4/变量命名规范.md","ref":"Chapter4/变量命名规范.md","articles":[]},"dir":"ltr"},"config":{"plugins":["toggle-chapters","sectionx","tbfed-pagefooter","include-codeblock","splitter","mermaid","codeblock-filename","prism","-highlight","simple-page-toc","navigator"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"Copyright &copy shxdledu.cn 2018","modify_label":"该文件修订时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"prism":{},"simple-page-toc":{"maxDepth":3,"skipFirstH1":true},"splitter":{},"search":{},"mermaid":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"sectionx":{},"codeblock-filename":{},"navigator":{},"include-codeblock":{"check":false,"edit":false,"fixlang":false,"lang":"","template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":true,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"toggle-chapters":{}},"theme":"default","author":"波波","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":" GO语言 web服务器区块链开发工程师就业班课程","language":"zh-hans","links":{"sidebar":{"关于作者":"http://www.shxdledu.cn/single/About-Me"}},"gitbook":"*","description":" GO语言 web服务器区块链开发工程师就业班课程"},"file":{"path":"Chapter5/基础数据类型.md","mtime":"2019-11-05T16:42:00.025Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-11-06T17:01:48.340Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-toggle-chapters/toggle.js"></script>
        
    
        
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sectionx/sectionx.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

